package com.wugh.fast.security.social.app.qq.connet;


import com.wugh.fast.security.social.app.qq.api.QQApi;
import com.wugh.fast.security.social.app.qq.api.QQApiImpl;
import org.springframework.social.oauth2.AbstractOAuth2ServiceProvider;

/**
 * @author wugh
 */
public class QQServiceProvider extends AbstractOAuth2ServiceProvider<QQApi> {

    private String appId;

    private static final String URL_AUTHORIZE = "https://graph.qq.com/oauth2.0/authorize";

    private static final String URL_ACCESS_TOKEN = "https://graph.qq.com/oauth2.0/token";

    public QQServiceProvider(String appId, String appSecret) {
        super(new QQOAuth2Template(appId, appSecret, URL_AUTHORIZE, URL_ACCESS_TOKEN));
        this.appId = appId;
    }

    @Override
    public QQApi getApi(String accessToken) {
        return new QQApiImpl(accessToken, appId);
    }

}
